using Microsoft.Xna.Framework;
using Ninject;

namespace EngineDevelopment.DependencyInjection
{
    public class InjectedGame : Game
    {
        private float _fps;

        public string Framerate
        {
            get { return _fps.ToString(); }
        }

        private StandardKernel _kernel;
        public StandardKernel Kernel
        {
            get
            {
                if (_kernel == null)
                    _kernel = new StandardKernel(new EngineModule());
                return _kernel;
            }
            set { _kernel = value; }
        }

        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            UpdateFramerate(gameTime);
        }

        private void UpdateFramerate(GameTime time)
        {
            _fps = 1 / (float)time.ElapsedGameTime.TotalSeconds;
        }
    }
}